package com.usian.admin.controller;

import com.usian.admin.service.AdUserService;
import com.usian.apis.admin.AdminLoginControllerApi;
import com.usian.model.admin.dtos.AdUserDto;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("login")
public class AdminLoginController implements AdminLoginControllerApi {

    @Autowired
    private AdUserService adUserService;

    @RequestMapping("in")
    @Override
    public ResponseResult login(AdUserDto dto) {
        return adUserService.login(dto);
    }

    //测试密码
    public static void main(String[] args) {
        String salt = "123456";
        String pswd = "guest"+salt;

        String saltPswd = DigestUtils.md5DigestAsHex(pswd.getBytes());
        System.out.println(saltPswd);
//34e20b52f5bd120db806e57e27f47ed0
    }
}
